package com.jieshuibao.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.jieshuibao.model.domain.CookieUser;

@Component
public class CheckUserOnlineService {
	
	@Resource
	private RedisService redisService;
	
	public String isOnline(String cookieId){
		if(cookieId!=null){
			CookieUser cookieUser = redisService.getObejct(cookieId,
					CookieUser.class);
			if(cookieUser!=null){
				String phoneNumber = cookieUser.getPhoneNumber();
				if(phoneNumber!=null){
					return phoneNumber;
				}else {
					return "2";	
				}
				
			}else {
				return "2";
			}
			
		}else {
			return "2";
		}
		
	}
}
